﻿using EMRView.Extensions.HCAttribute;
using HC.View;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace EMRView.Extensions.Command.StandardCommand.Table
{
    [Command(CommandType.表格, "ShowHideBorder", "显示/隐藏边框")]
    public class ShowHideBorderCommand : BaseCommand
    {
        public override Icon CommandIcon => null;

        public override object Execute(HCEmrView _view, bool showDefaultUI = false, params object[] para)
        {
            if (_view.ActiveSection.ActiveData.GetActiveItem() is HCTableItem)
            {
                HCTableItem vTable = _view.ActiveSection.ActiveData.GetActiveItem() as HCTableItem;
                vTable.BorderVisible = !vTable.BorderVisible;
                _view.OnChangedSwitch.Invoke(_view, null);
                _view.UpdateView();
            }
            return null;
        }

        public override void InitControl(object control)
        {
        }
    }
}
